<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>文章列表</title>
</head>

<body>
<div style="text-align:center;">
<h2>文章列表 <span><a href="/admin/article/add">添加</a></span></h2>
<%=url%>

<% if(data.length){ %>
<table width="100%" border="1">
  <tbody>
    <tr>
      <td>ID</td>
      <td>标题</td>
      <td>编辑</td>
      <td>删除</td>
    </tr>
    <% data.forEach(function(item){ %>
    <tr>
      <td><%=item.itemid%></td>
      <td><%=item.title%></td>
      <td><a href="/admin/article/mod?itemid=<%=item.itemid%>">编辑</a></td>
      <td><a onClick="return confirm('确定要删除么？');" href="/admin/article/del?itemid=<%=item.itemid%>">删除</a></td>
    </tr>
    <% }) %>
  </tbody>
</table>
<br>
<div>
	<% var prev_page=page-1;if(prev_page<=1) prev_page=1 %>
    <% var next_page=page+1;if(next_page>=total_page) next_page=total_page %>
	<input type="button" value="上一页" onClick="location.href='/admin/article/index?page=<%=prev_page%>'" <%if(page==1){%>disabled<%}%>>
    <% for(var i=1;i<=total_page;i++){ %>
    <input type="button" value="<%=i%>" onClick="location.href='/admin/article/index?page=<%=i%>';" <%if(i==page){%>disabled<%}%>>
    <% } %>
    <input type="button" value="下一页" onClick="location.href='/admin/article/index?page=<%=next_page%>'" <%if(page==total_page){%>disabled<%}%>>
</div>

<% } %>

</div>
</body>
</html>
